﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Data;
using entity;
public partial class product : Basic
{
    public string Jrjiepan;
    public string MTnews;
    public string ProductNews = "暂无产品动态";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Jrjiepan = Today_Video().ToString();
            MTnews = sb_媒体聚焦().ToString();
            ProductNews = sb_产品动态().ToString();
        }
    }

    /// <summary>
    /// 今日解盘
    /// </summary>
    /// <returns></returns>
    protected StringBuilder Today_Video()
    {
        StringBuilder sb = new StringBuilder();

        VideoBiz biz = new VideoBiz();
        List<VideoEnty> list = biz.GetVideoList(4);

        try
        {
            if (list.Count > 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    if (i == 0)
                    {
                        sb.AppendLine("<ul>");
                        sb.AppendLine("<li class=\"gray\" style=\"line-height:20px;\"><span class=\"gray\" style=\"line-height:20px;\">");
                        sb.AppendLine("<a href=\"" + list[0].v_url + "\">");
                        sb.AppendLine("<img src=\"images/index_pic3.jpg\" width=\"94\" height=\"89\" align=\"left\" class=\"img\" style=\"border:0px;\"/>");
                        sb.Append("</a>");
                        sb.AppendLine("</span>");
                        sb.AppendLine("<a href=\"" + list[0].v_url + "\" class=\"font-weight b\">每日解盘</a><br />");
                        sb.Append(list[0].v_title + list[0].v_remark);

                    }
                    else
                    {
                        if (i == 1)
                        {

                            sb.AppendLine("</li>");
                            sb.AppendLine("<div class=\"clearok\"></div>");
                        }
                        sb.AppendLine("<li> ·<a href=\"" + list[i].v_url + "\">" + list[i].v_title + " " + list[i].v_remark + "</a> </li>");

                    }
                }

                sb.AppendLine("</ul>");
            }
        }
        catch
        {

            sb = new StringBuilder();
        }
        return sb;
    }

    public StringBuilder sb_媒体聚焦()
    {
        StringBuilder sb = new StringBuilder();
        string str = UrlGet.Get("news/NewsListMany.ashx?typeid=0501&top=4");
        var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<NewsList>>(str);


        if (list.Count > 0)
        {
            foreach (var item in list)
            {
                sb.AppendLine("<ul>");
                foreach (var m in item.list)
                {
                    if (string.IsNullOrEmpty(m.Source))
                    {
                        m.Source = "未知来源";
                    }


                    sb.AppendLine("<li> ·<span class=\"gray\">[" + m.Source + "]</span><a href=\"" + GetNewsUrl("15", "0501", m.Id) + "\">" + m.Title + "</a></li>");

                }
                sb.AppendLine("</ul>");
            }
        }





        return sb;

    }


    // 0404
    public StringBuilder sb_产品动态()
    {
        StringBuilder sb = new StringBuilder();
        string str = UrlGet.Get("news/NewsListMany.ashx?typeid=0404&top=4");
        var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<NewsList>>(str);
        if (list.Count > 0)
        {
            foreach (var item in list)
            {
                sb.AppendLine("<ul>");
                foreach (var m in item.list)
                {
                    sb.AppendLine("<li> ·<a href=\"" + GetNewsUrl("15", "0404", m.Id) + "\">" + m.Title + "</a> </li>");

                }
                sb.AppendLine("</ul>");
            }
        }
        else
        {
            sb.AppendLine("<ul>");

            sb.AppendLine("<li>暂无产品动态信息 </li>");

            sb.AppendLine("</ul>");
        }
        return sb;


    }


}